package cn.javass.dp.chianofresponsibility.example5;

public class Client {
    public static void main(String[] args) {
  /*      Handle h1 = new ProjectManager();
        Handle h2 = new DepManager();
        Handle h3 = new GeneralManager();

        h1.setSuccessor(h2);
        h2.setSuccessor(h3);


        FeeRequestModel frm = new FeeRequestModel();
        frm.setFee(300);
        frm.setUser("小李");

        String ret1 = (String)h1.handleRequest(frm);
        System.out.println("ret1 = " + ret1);

        frm.setFee(800);
        h3.handleRequest(frm);
        String ret2 = (String)h1.handleRequest(frm);
        System.out.println("ret2 = " + ret2);*/

        Handle h1 = new ProjectManager2(); //包含父类方法  自动根据类型匹配
        Handle h2 = new DepManager2();
        Handle h3 = new GeneralManager2();
        //会经过 所有的 requestRequest 重载的方法

        h1.setSuccessor(h2);
        h2.setSuccessor(h3);

/*
        PreFeeRequestModel frm = new PreFeeRequestModel();
*/
        FeeRequestModel frm = new FeeRequestModel();
        frm.setFee(11300);
        frm.setUser("ccc");

        String ret  = (String)h1.handleRequest(frm);
        System.out.println("ret = " + ret);



/*
        frm.setFee(111300);
        frm.setUser("小李");

        h1.handleRequest(frm);

        frm.setFee(800);
        h1.handleRequest(frm);*/




    }
}
